﻿// owner 蒋家伟

#pragma once
#include "TaskBase_home.h"
#include <QMetaType>

namespace jsdk
{
    // 任务Id
    class TASKBASE_EXPORT TaskId
    {
    public:
        explicit TaskId(size_t id = 0);
        ~TaskId() {}
        bool isValid() const;
        size_t toValue() const;
    public:
        // 重载运算符
        bool operator==(const TaskId& taskId) const;
        bool operator!=(const TaskId& taskId) const;
        TaskId& operator=(const TaskId& taskId);
        bool operator<(const TaskId& taskId) const;
        bool operator>(const TaskId& taskId) const;

        static const TaskId s_InvalidTaskId;
    private:
        size_t m_taskId;
    };

    Q_DECLARE_METATYPE(TaskId);

    struct TASKBASE_EXPORT HashTaskId
    {
        size_t operator()(const TaskId& taskId) const;
    };
}